package com.example.helloword.dao;

import com.example.helloword.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @create 2022-03-2022/3/9-20:47
 */

@Repository
public class DepartmentDao {
    private static Map<Integer, Department> departments = null;

    static {
        departments = new HashMap<Integer,Department>();
        departments.put(0,new Department(0,"无部门"));
        departments.put(1,new Department(1,"生产部"));
        departments.put(2,new Department(2,"运输部"));
        departments.put(3,new Department(3,"销售部"));
        departments.put(4,new Department(4,"人事部"));
        departments.put(5,new Department(5,"质检部"));
    }


    //获取所有信息
    public Collection<Department> getAllDepartment(){
        return departments.values();
    }

    //通过id获取部门
    public Department getDeparmentById(Integer id){
        return departments.get(id);
    }



}
